package com.zx.idc.backend.gui.sys;


import com.zx.idc.backend.gui.common.BaseApi;
import com.zx.idc.backend.gui.common.Result;
import com.zx.idc.ds.sys.entity.SysUserRole;
import com.zx.idc.ds.sys.service.ISysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户角色对应 前端控制器
 * </p>
 *
 * @author rxliuli
 * @since 2019-01-31
 */
@RestController
@RequestMapping("/api/sysUserRole")
public class SysUserRoleController extends BaseApi {

    @Autowired
    private ISysUserRoleService iSysUserRoleService;

    @GetMapping("/get/user-id/{userId}")
    public Result<List<SysUserRole>> getByUserId(@PathVariable("userId") Integer userId) {
        return success(
            iSysUserRoleService.selectList(new SysUserRole().setUserId(userId))
        );
    }
}

